package concept.misc;

import java.text.DateFormat;
import java.util.Date;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.context.support.ClassPathXmlApplicationContext;

class SomeClass
{
	String name;

	{
		System.err.println("This is called only once.");
		name = new Date().toString();
	}
	
	SomeClass()
	{
		//name = DateFormat.getDateInstance(DateFormat.LONG).format(new Date());
	}

}

public class ClassLoadLab
{
	private String name;
	
	public ClassLoadLab()
	{
		
	}
	
	public ClassLoadLab(String aName)
	{
		name = aName;
	}
	
	public void setName(String name)
	{
		this.name = name;
	}
	
	public static void main(String[] args)
	{
		ClassLoadLab lab = (ClassLoadLab)new ClassPathXmlApplicationContext("classpath:jmx-config.xml").getBean("classLab");
		System.out.println(lab.name);
		ClassLoadLab lab2 = (ClassLoadLab)new ClassPathXmlApplicationContext("classpath:jmx-config.xml").getBean("classLab", new Object[]{"randome"});
		System.out.println(lab2.name);

		/*
		SomeClass clz = new SomeClass();
		System.out.println(clz.name);
		System.out.println(clz.name);
		System.out.println(clz.name);
		 * */
	}

}
